<?php
$title = '风控设置';
/** @var array $riskConfig */
require __DIR__ . '/../partials/head.php';
require __DIR__ . '/../partials/nav.php';
?>
<section class="section">
    <div class="app-container" style="display:flex;flex-direction:column;gap:24px;">
        <div class="card" style="gap:18px;">
            <h2 style="margin:0;">白名单与限流</h2>
            <div class="grid-2">
                <div>
                    <h4>允许的 Connector</h4>
                    <p><?= htmlspecialchars(implode(', ', $riskConfig['allowed_connectors'])) ?></p>
                </div>
                <div>
                    <h4>允许的交易对</h4>
                    <p><?= htmlspecialchars(implode(', ', $riskConfig['allowed_symbols'])) ?></p>
                </div>
                <div>
                    <h4>允许的订单类型</h4>
                    <p><?= htmlspecialchars(implode(', ', $riskConfig['allowed_order_types'])) ?></p>
                </div>
                <div>
                    <h4>名义上限</h4>
                    <p><?= htmlspecialchars((string)$riskConfig['max_notional_default']) ?> USDT</p>
                </div>
                <div>
                    <h4>脚本限流</h4>
                    <p><?= htmlspecialchars((string)$riskConfig['webhook_rate_per_min']) ?> 次/分钟</p>
                </div>
                <div>
                    <h4>用户限流</h4>
                    <p><?= htmlspecialchars((string)$riskConfig['user_rate_per_min']) ?> 次/分钟</p>
                </div>
            </div>
        </div>
        <div class="card" style="gap:18px;">
            <h2 style="margin:0;">滑点与价格保护</h2>
            <p>滑点保护：<?= $riskConfig['slippage_guard']['enabled'] ? '已启用' : '未启用' ?></p>
            <p>阈值：<?= htmlspecialchars((string)$riskConfig['slippage_guard']['bps_limit']) ?> bps</p>
        </div>
        <div class="card" style="gap:18px;">
            <h2 style="margin:0;">审计导出</h2>
            <p style="color:var(--text-secondary);">通过下方链接可导出 CSV 或在线检索。</p>
            <div style="display:flex;gap:12px;">
                <a class="btn" href="/admin/audit">进入审计</a>
                <a class="btn-ghost btn" href="/admin/audit?format=csv">导出 CSV</a>
            </div>
        </div>
    </div>
</section>
<?php require __DIR__ . '/../partials/footer.php'; ?>
